<?php
namespace data\site;
use \data\BaseData;
/**
 * 站点数据管理
 */
class SiteListData extends BaseData{
    
    
    /**
     * 读取一个简单的基础列表
     */
    public function getSimpleList($param){
        $page = $param['page']?:1;
        $limit= $param['limit']?:99;
        $check = ['name'=> 'like','status','msiteid','siteid'];
        $where = $this->parseWhere($check,$param);
        $list  = M("site")->where($where)->order('siteid desc')->page($page)->limit($limit)->select();
        return $list;        
    }
    
    /**
     * 列表读取
     */
    public function getList($param){
        $page = $param['page']?:1;
        $limit= $param['limit']?:20;
        $check = ['s.name'=> 'like','s.status','m.adduserid','m.opentype','s.msiteid'];
        $where = $this->parseWhere($check,$param);
        $list  = M("site")->alias('s')->leftJoin('elite_site_main m','s.msiteid = m.id')
        ->where($where)->order('siteid desc')->page($page)->limit($limit)->select();
        //pr(M()->getLastSql());
        $total = M('site')->alias('s')->leftJoin('elite_site_main m','s.msiteid = m.id')
        ->where($where)->count();
        return [            
            'page' => $page,
            'limit' => $limit,
            'total'=> $total,
            'list' => $list,
        ];
    }
    
    
    
    
}